Skip to main content

Technical documentation

The following script runs actions once it detects that the widget exists and has loaded correctly on that URL. It must be placed below the main Ocular script in order to work.

<script>
const onOcularWidgetReady = () => {
// You can run Ocular functions or your own code here.
}
</script>

The Ocular functions that can be run in the script, or that can also be run as an onclick event, are the following:

ocularWidget.show()Widget icon always visible
ocularWidget.show(true)Widget fully open in form view
ocularWidget.hide()Widget always hidden
ocularWidget.toggle()Allow the widget to toggle
ocularWidget.maximize()Allow maximizing the widget size
ocularWidget.minimize()Allow restoring the widget's default size
ocularWidget.align("right")Set the widget position; the values to use for the position variable are "left","center","right"
ocularWidget.getDevice()Get data about the device interacting with the element
ocularWidget.showPopUp(true, true)Show the pop-up and play the alert
ocularWidget.showPopUp(false, false)Hide the pop-up and mute the alert
ocularWidget.setPopUpContent("text")Edit the pop-up content

ocularWidget.setCustomer({
cellphone: "0123456789",
countryCode: "+00",
email: "correo@mail.com",
name: "nombre",
})

Set data in the initial form fields

The Ocular widget can be embedded in a container so you can control its shape and size in whichever views you want. To do so, simply add the id "ocular-service-container" to any HTML element:

<div id="ocular-service-container"></div>

With Ocular it is also possible to build API-level integrations. For more information, contact us at soporte@ocularsolution.com